#ifndef SIMPLERICHEDITOR_H
#define SIMPLERICHEDITOR_H

#include <QWidget>

namespace Ui {
    class SimpleRichEditor;
}

class QToolButton;
class QComboBox;
class QFontComboBox;
class QTextCursor;
class QTextBlockFormat;

class SimpleRichEditor : public QWidget
{
    Q_OBJECT

public:
    explicit SimpleRichEditor(QWidget *parent = 0);
    ~SimpleRichEditor();

    QVariant data() const;
    void setData(QVariant data);

private:
    Ui::SimpleRichEditor *ui;

private slots:
    void formatIndentLess();
    void formatIndentMore();
    void formatJustifyLeft();
    void formatJustifyCenter();
    void formatJustifyRight();
    void formatJustifyFill();
    void formatTextBold(bool);

    void insertImage();
    void insertImage(QString);

    void listEnum();
    void listBullet();

    void updateFormatButtons();
    void updateFontCombo();

    void setCurrentFontSize(QString value);       

private: // HELPERS
    QToolButton *tbItalic, *tbBold, *tbUnderLine;
    QFontComboBox *cbFonts;
    QComboBox *cbFontSizes;

    QToolButton* addToolButton(QString iconText, const char* slot, QObject* dest = 0, bool toggle = false);
    void createStandardToolbar();
    void updateBulletList(QTextCursor* cursor, QTextBlockFormat* blockFmt);
    void updateEnumList(QTextCursor* cursor, QTextBlockFormat* blockFmt);
};

#endif // SIMPLERICHEDITOR_H
